<template>
<el-dialog v-model="visible" title="矩形阵列" width="30%" draggable>
        <div>
            <el-row>
                <label for="rowCountInput" style="padding-right:10px;position: relative; left:10px">行数</label>
                <el-input v-model="rowCount" autofocus size="mini" :ref="rowCountInput" id="rowCountInput"></el-input>
                <label for="rowSpanInput" style="padding-right:180px;position: relative; left:10px">间距</label>
                <el-input v-model="rowSpan" autofocus size="mini" :ref="rowSpanInput" id="rowSpanInput"></el-input>
                <el-button type="primary" @click="onSelPointOnMap('row')">图上测量</el-button>
            </el-row>
            <el-row>
                <label for="colCountInput" style="padding-right:10px;position: relative; left:10px">列数</label>
                <el-input v-model="colCount" autofocus size="mini" :ref="colCountInput" id="colCountInput"></el-input>
                <label for="colSpanInput" style="padding-right:180px;position: relative; left:10px">间距</label>
                <el-input v-model="colSpan" autofocus size="mini" :ref="colSpanInput" id="colSpanInput"></el-input>
                <el-button type="primary" @click="onSelPointOnMap('col')">图上测量</el-button>
            </el-row>
        </div>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="visible = false">Cancel</el-button>
                <el-button type="primary" @click="onConfirm">
                    Confirm
                </el-button>
            </span>
        </template>
    </el-dialog>
</template>
    
<script  setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus';
import {LGXEnums}  from '../../script/canvas/common/sysenum'
const visible = ref(false)

const rowCount = ref("0")
const rowSpan = ref("60")

const colCount = ref("0")
const colSpan = ref("60")

var initDatas = function(){
    console.log("rect array initDatas --------------");
}

const onConfirm = () => {
    console.log("rect array confirm --------------");
    visible.value = false;
    window.mainctl.m_pEditINTF.rectArray(rowCount.value,rowSpan.value,colCount.value,colSpan.value);
    window.mainctl.setMapWorkMode(LGXEnums.LGXWorkMode.ModifyMode);
}

const onSelPointOnMap = (type) =>{
    console.log("pick span on map:"+type);
    visible.value = false;
    window.selPointSrcDlgType = "rectArr";
    window.mainctl.setMapWorkMode(LGXEnums.LGXWorkMode.PickPointMode);
}

defineExpose({
    visible,
    initDatas
});

</script>
    